//
// Created by xili on 2024/8/3 14:11.
// Go big or go home.
//
#include <iostream>
#include <unordered_map>

using namespace std;

class Solution {
public:
    int maxNumberOfBalloons(string text) {
        //记录每个字符出现的次数，对l和o单独处理每次加0.5
        string s = "balon";
        unordered_map<char, double> ump;
        for (auto &item: text) {
            if (item == 'l' || item == 'o') {
                ump[item] += 0.5;
            } else {
                ump[item]++;
            }
        }
        double ans = INT32_MAX;
        for (auto &item: s) {
            ans = ans > ump[item] ? ump[item] : ans;
        }
        return (int) ans;
    }
};